#include "lvgl_ZhuoMian.h"
#include "lvgl_Project.h"




_lvgl_ZhuoMian_GongNeng_Data lvgl_ZhuoMian_GongNeng_Data;
_ZhuoMian_ChuangKou ZhuoMian_ChuangKou;

lv_obj_t *lvgl_ZhuoMian_main_cont = NULL;
lv_style_t lvgl_ZhuoMian_style;
lv_task_t * lvgl_ZhuoMian_task = NULL;

lv_obj_t *lvgl_ZhuoMian_Button[ZhuoMian_Button_Num];
lv_obj_t *lvgl_ZhuoMian_Label[ZhuoMian_Button_Num];
lv_style_t lvgl_ZhuoMian_Button_style[ZhuoMian_Button_Num];



const char*ZhuoMian_TEXT[][SYSTEM_LANGUAGE_NUM] =
{
	{ "天气", "天氣", "Weather", NULL},
	{ "B站", "B站", "bilibili", NULL},
	{ "黄历", "黃曆", "Yellow calendar", NULL},
	{ "设置", "設定", "Set", NULL},
	{ "日历", "日曆", "Calendar", NULL},
	{ "游戏", "遊戲", "Game", NULL},
	{ "音乐", "音樂", "Music", NULL},
	{ "视频", "視頻", "Video", NULL},
	{ "图片", "圖片", "Photo", NULL},
	{ "闹钟", "鬧鐘", "Alarm clock", NULL},
	{ "计算器", "小算盘", "Calculator", NULL},
	{ "运动", "運動", "Sport", NULL},
	{ "时钟", "時鐘", "Clock", NULL},


};

lv_obj_t *ZhuoMian_BUTTON_handle[] =
{
	&ZhuoMian_ChuangKou.lvgl_TianQi,
	&ZhuoMian_ChuangKou.lvgl_BZhan,
	&ZhuoMian_ChuangKou.lvgl_HuangLi,
	&ZhuoMian_ChuangKou.lvgl_SheZhi,
	&ZhuoMian_ChuangKou.lvgl_RiLi,
	&ZhuoMian_ChuangKou.lvgl_YouXi,
	&ZhuoMian_ChuangKou.lvgl_YinYue,
	&ZhuoMian_ChuangKou.lvgl_ShiPin,
	&ZhuoMian_ChuangKou.lvgl_JiSuanQi,
	&ZhuoMian_ChuangKou.lvgl_NaoZhong,

};


lv_area_t ZhuoMian_BUTTON_area[] =
{
	{5,5,125,65},{135,5,100,65},
	{5,75,155,65},{165,75,70,65},
	{5,145,70,80},{80,145,155,80},
	{5,230,113,75},{123,230,112,75},
	{5,310,155,65},{165,310,70,65},
	{5,380,113,80},{123,380,113,80},

	{5,465,230,130},
};


uint32_t ZhuoMian_BUTTON_color[][2]=
{
	{0Xff00ff,0Xbc0cc1},{0X8cc63f,0X678931},
	{0X22b573,0X1a7047},{0X2e3192,0X1e2259},
	{0X998675,0X5b5148},{0X29abe2,0X1f7b9b},
	{0Xd4145a,0X991349},{0Xf7931e,0Xba6919},
	{0Xff00ff,0Xa809ad},{0X8cc63f,0X5c7c2a},
	{0Xa67c52,0X75583d},{0Xd9e021,0X999916},

	{0X333333,0X1c1c1c},
};


void lvgl_ZhuoMian_button_cb(struct _lv_obj_t * obj, lv_event_t event)
{
	int i = 0;
	//printf("cb:%d\r\n", event);
	switch (event)
	{

	case LV_EVENT_PRESSING://对象被连续按下

		break;
	case LV_EVENT_PRESSED://对象已被按下


		break;


	case LV_EVENT_CLICKED://非拖动下释放
		if (lvgl_ZhuoMian_GongNeng_Data.DongHua_Flag == false)
		{
			lvgl_ZhuoMian_GongNeng_Data.DongHua_Flag = true;
		}
		else
		{
			break;
		}

		for (i = 0; i < ZhuoMian_Button_Num; i++)
		{
			if (lvgl_ZhuoMian_Button[i] == obj)
			{

				lvgl_ZhuoMian_GongNeng_Data.AnXia_Num = i;
				printf("AnXia_Num:%d\r\n", lvgl_ZhuoMian_GongNeng_Data.AnXia_Num);
				break;
			}
		}
		
		lvgl_ZhuoMian_GongNeng_Data.AnXia_button = obj;
		ZhuoMian_DongHua_Chu();

	break;





	case LV_EVENT_RELEASED://按钮释放


		break;


	case ZhuoMian_event_anXia:
		if (obj == lvgl_ZhuoMian_Button[0])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);
			lvgl_TianQi_create(lv_scr_act());
		}
		else
		if (obj == lvgl_ZhuoMian_Button[1])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);

			lvgl_bilibili_create(lv_scr_act());
		}
		else
		if (obj == lvgl_ZhuoMian_Button[2])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);
	
			lvgl_LaoHuangLi_create(lv_scr_act());
		}
		else
		if (obj == lvgl_ZhuoMian_Button[3])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);

			lvgl_SheZhi_create(lv_scr_act());
		}	
		else
		if (obj == lvgl_ZhuoMian_Button[4])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);

			lvgl_RiLi_create(lv_scr_act());
		}
		else
		if (obj == lvgl_ZhuoMian_Button[5])
		{
			lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);

			lvgl_wenjian_create(lv_scr_act(), ZhuoMian_TEXT[5][SYSTEM_Get_Language()], ZhuoMian_BUTTON_color[5][0], ZhuoMian_BUTTON_color[5][1]);
		}		
		else
		{
			lvgl_tishi_create(lv_scr_act(),"暂时还没有添加",200,3);
			//ZhuoMian_DongHua_Jin();
		
		}
		lvgl_ZhuoMian_GongNeng_Data.DongHua_Flag = false;
	break;

	case LV_EVENT_LONG_PRESSED://按钮长按



		break;
	default:
		break;

	}



}

void lvgl_ZhuoMian_event_cb(struct _lv_obj_t * obj, lv_event_t event)
{
	if (obj == lvgl_ZhuoMian_main_cont)
	{
		//ZhuoMian_DEBUG("cb:%d\r\n", event);
		switch (event)
		{

		case LV_EVENT_DELETE:

			lvgl_ZhuoMian_main_cont = NULL;
			ZhuoMian_DEBUG("删除窗口\r\n");
			break;

		case LV_EVENT_PRESSING://对象被持续按下


			break;
		case LV_EVENT_PRESSED://对象已被按下


			break;
		case LV_EVENT_DRAG_END://拖动结束后

			if (lv_obj_get_x(lvgl_ZhuoMian_main_cont) != 0)
			{
				if (lv_obj_get_x(lvgl_ZhuoMian_main_cont) > 100)
				{
					
					
					lvgl_ZhuoMian_close();


				}
				else
				{
					lv_obj_set_x(lvgl_ZhuoMian_main_cont, 0);
				}
			}
			if (lv_obj_get_y(lvgl_ZhuoMian_main_cont) > 0)
			{

				lv_obj_set_y(lvgl_ZhuoMian_main_cont, 0);

			}else if (lv_obj_get_y(lvgl_ZhuoMian_main_cont) < -(lv_obj_get_height(lvgl_ZhuoMian_main_cont)-240))
			{

				lv_obj_set_y(lvgl_ZhuoMian_main_cont, -(lv_obj_get_height(lvgl_ZhuoMian_main_cont) - 240));

			}
			
			break;
			break;

		case LV_EVENT_RELEASED://按钮释放

		case LV_EVENT_LONG_PRESSED://按钮长按

			break;




		default:
			break;

		}

	}
}
static lv_style_t style_btn;
static lv_style_t style_btn_red;
void lv_ex_get_started_222(void)
{


	/*Create a simple button style*/
	lv_style_init(&style_btn);
	lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10);
	lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER);
	lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_SILVER);
	lv_style_set_bg_grad_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_GRAY);
	lv_style_set_bg_grad_dir(&style_btn, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);

	/*Swap the colors in pressed state*/
	lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_GRAY);
	lv_style_set_bg_grad_color(&style_btn, LV_STATE_PRESSED, LV_COLOR_SILVER);

	/*Add a border*/
	lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE);
	lv_style_set_border_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_70);
	lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 2);

	/*Different border color in focused state*/
	lv_style_set_border_color(&style_btn, LV_STATE_FOCUSED, LV_COLOR_BLUE);
	lv_style_set_border_color(&style_btn, LV_STATE_FOCUSED | LV_STATE_PRESSED, LV_COLOR_NAVY);

	/*Set the text style*/
	lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, LV_COLOR_WHITE);

	/*Make the button smaller when pressed*/
	lv_style_set_transform_height(&style_btn, LV_STATE_PRESSED, -5);
	lv_style_set_transform_width(&style_btn, LV_STATE_PRESSED, -10);
#if LV_USE_ANIMATION
	/*Add a transition to the size change*/
	static lv_anim_path_t path;
	lv_anim_path_init(&path);
	lv_anim_path_set_cb(&path, lv_anim_path_overshoot);

	lv_style_set_transition_prop_1(&style_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_HEIGHT);
	lv_style_set_transition_prop_2(&style_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH);
	lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 300);
	lv_style_set_transition_path(&style_btn, LV_STATE_DEFAULT, &path);
#endif

	/*Create a red style. Change only some colors.*/
	lv_style_init(&style_btn_red);
	lv_style_set_bg_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_RED);
	lv_style_set_bg_grad_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_MAROON);
	lv_style_set_bg_color(&style_btn_red, LV_STATE_PRESSED, LV_COLOR_MAROON);
	lv_style_set_bg_grad_color(&style_btn_red, LV_STATE_PRESSED, LV_COLOR_RED);
	lv_style_set_text_color(&style_btn_red, LV_STATE_DEFAULT, LV_COLOR_WHITE);
#if LV_USE_BTN
	/*Create buttons and use the new styles*/
	lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL);     /*Add a button the current screen*/
	lv_obj_set_pos(btn, 10, 10);                            /*Set its position*/
	lv_obj_set_size(btn, 120, 50);                          /*Set its size*/
	lv_obj_reset_style_list(btn, LV_BTN_PART_MAIN);         /*Remove the styles coming from the theme*/
	lv_obj_add_style(btn, LV_BTN_PART_MAIN, &style_btn);

	lv_obj_t * label = lv_label_create(btn, NULL);          /*Add a label to the button*/
	lv_label_set_text(label, "Button");                     /*Set the labels text*/

	/*Create a new button*/
	lv_obj_t * btn2 = lv_btn_create(lv_scr_act(), btn);
	lv_obj_set_pos(btn2, 10, 80);
	lv_obj_set_size(btn2, 120, 50);                             /*Set its size*/
	lv_obj_reset_style_list(btn2, LV_BTN_PART_MAIN);         /*Remove the styles coming from the theme*/
	lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &style_btn);
	lv_obj_add_style(btn2, LV_BTN_PART_MAIN, &style_btn_red);   /*Add the red style on top of the current */
	lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); /*Add a local style*/

	label = lv_label_create(btn2, NULL);          /*Add a label to the button*/
	lv_label_set_text(label, "Button 2");                     /*Set the labels text*/
#endif
}



lv_style_t lvgl_ZhuoMian_BeiJing_style;
void lvgl_ZhuoMian_create(lv_obj_t * Fu)
{
	
	if (lvgl_ZhuoMian_main_cont == NULL)
	{

		lv_style_init(&lvgl_ZhuoMian_BeiJing_style);
		lv_style_copy(&lvgl_ZhuoMian_BeiJing_style, &lvgl_WuBianKuang_cont_style);

		/*渐变色*/
		lv_style_set_bg_opa(&lvgl_ZhuoMian_BeiJing_style, LV_STATE_DEFAULT, LV_OPA_COVER);//背景透明度
		lv_style_set_bg_color(&lvgl_ZhuoMian_BeiJing_style, LV_STATE_DEFAULT, LV_COLOR_BLACK);//背景上面颜色
		lv_style_set_bg_grad_color(&lvgl_ZhuoMian_BeiJing_style, LV_STATE_DEFAULT, LV_COLOR_BLACK);//背景上面颜色

		lv_obj_add_style(lv_scr_act(), LV_OBJ_PART_MAIN, &lvgl_ZhuoMian_BeiJing_style);//设置样式


		//lv_ex_get_started_222();
		//return;



		lv_style_init(&lvgl_ZhuoMian_style);
		lv_style_copy(&lvgl_ZhuoMian_style, &lvgl_WuBianKuang_cont_style);
		/*渐变色*/
		lv_style_set_bg_opa(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, LV_OPA_COVER);//背景透明度
		//lv_style_set_bg_color(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, lv_color_hex(0x1b1d5c));//背景上面颜色
		//lv_style_set_bg_grad_color(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, lv_color_hex(0x5c418d));//背景上面颜色
		lv_style_set_bg_color(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, LV_COLOR_BLACK);//背景上面颜色
		lv_style_set_bg_grad_color(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, LV_COLOR_BLACK);//背景上面颜色
		lv_style_set_bg_grad_dir(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, LV_GRAD_DIR_VER);//渐变方向

		/*调整渐变色位置*/
		lv_style_set_bg_main_stop(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, 10);
		lv_style_set_bg_main_stop(&lvgl_ZhuoMian_style, LV_STATE_DEFAULT, 100);

		//----创建容器----//
		lvgl_ZhuoMian_main_cont = lv_cont_create(lv_scr_act(), NULL);
		lv_obj_set_pos(lvgl_ZhuoMian_main_cont, 0, 0);
		lv_obj_set_size(lvgl_ZhuoMian_main_cont, 240, 600);
		//lv_obj_set_drag_parent(lvgl_ZhuoMian_main_cont, true); //启用 / 禁用父对象可拖动

		lv_obj_set_click(lvgl_ZhuoMian_main_cont, true); //启用 / 禁用可点击
		lv_obj_set_drag(lvgl_ZhuoMian_main_cont, true);//启用/禁用对象可拖动
		lv_obj_set_drag_dir(lvgl_ZhuoMian_main_cont, LV_DRAG_DIR_ONE);//设置拖动方向
		lv_obj_set_drag_throw(lvgl_ZhuoMian_main_cont, false);//启用/禁用拖动后是否有惯性移动

		//lv_obj_set_drag_parent(lvgl_ZhuoMian_main_cont, true); //启用 / 禁用父对象可拖动
		lv_obj_add_style(lvgl_ZhuoMian_main_cont, LV_OBJ_PART_MAIN, &lvgl_ZhuoMian_style);//设置样式
		lv_obj_set_event_cb(lvgl_ZhuoMian_main_cont, lvgl_ZhuoMian_event_cb);//设置回调函数


		



		for (int i = 0; i < ZhuoMian_Button_Num; i++)
		{
			lv_style_init(&lvgl_ZhuoMian_Button_style[i]);
			lv_style_copy(&lvgl_ZhuoMian_Button_style[i], &lvgl_WuBianKuang_cont_style);
			lv_style_set_radius(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, 10);//圆角
			lv_style_set_shadow_width(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, 0);//阴影宽度
			lv_style_set_shadow_opa(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, LV_OPA_TRANSP);//阴影透明度
			lv_style_set_bg_opa(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, LV_OPA_COVER);//背景透明度
			lv_style_set_bg_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, lv_color_hex(ZhuoMian_BUTTON_color[i][0]));//背景上面颜色
			lv_style_set_bg_grad_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, lv_color_hex(ZhuoMian_BUTTON_color[i][0]));//背景上面颜色		

			lv_style_set_bg_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_PRESSED, lv_color_hex(ZhuoMian_BUTTON_color[i][1]));
			lv_style_set_bg_grad_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_PRESSED, lv_color_hex(ZhuoMian_BUTTON_color[i][1]));

			lv_style_set_border_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_FOCUSED, LV_COLOR_BLUE);
			lv_style_set_border_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_FOCUSED | LV_STATE_PRESSED, LV_COLOR_NAVY);


			lv_style_set_text_color(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, LV_COLOR_WHITE);
			lv_style_set_text_font(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, (const lv_font_t*)&font_ZiDing_K8_24);

			lv_style_set_transform_height(&lvgl_ZhuoMian_Button_style[i], LV_STATE_PRESSED, -5);
			lv_style_set_transform_width(&lvgl_ZhuoMian_Button_style[i], LV_STATE_PRESSED, -10);
#if LV_USE_ANIMATION
			//Add a transition to the size change
			static lv_anim_path_t path;
			lv_anim_path_init(&path);
			lv_anim_path_set_cb(&path, lv_anim_path_overshoot);

			lv_style_set_transition_prop_1(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_HEIGHT);
			lv_style_set_transition_prop_2(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH);
			lv_style_set_transition_time(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, 200);
			lv_style_set_transition_path(&lvgl_ZhuoMian_Button_style[i], LV_STATE_DEFAULT, &path);
#endif


			lvgl_ZhuoMian_Button[i] = lv_btn_create(lvgl_ZhuoMian_main_cont,NULL);

			lv_obj_set_pos(lvgl_ZhuoMian_Button[i], ZhuoMian_BUTTON_area[i].x1, ZhuoMian_BUTTON_area[i].y1);
			lv_obj_set_size(lvgl_ZhuoMian_Button[i], ZhuoMian_BUTTON_area[i].x2, ZhuoMian_BUTTON_area[i].y2);

			lv_obj_set_drag_parent(lvgl_ZhuoMian_Button[i], true); //启用 / 禁用父对象可拖动

			lv_obj_reset_style_list(lvgl_ZhuoMian_Button[i], LV_BTN_PART_MAIN);         /*Remove the styles coming from the theme*/
			lv_obj_add_style(lvgl_ZhuoMian_Button[i], LV_BTN_PART_MAIN, &lvgl_ZhuoMian_Button_style[i]);//设置样式
			
			lvgl_ZhuoMian_Label[i] = lv_label_create(lvgl_ZhuoMian_Button[i], NULL);          /*Add a label to the button*/
			lv_label_set_text(lvgl_ZhuoMian_Label[i], ZhuoMian_TEXT[i][SYSTEM_Get_Language()]);                     /*Set the labels text*/

			//*ZhuoMian_BUTTON_handle[i] = *lvgl_ZhuoMian_Button[i];

			lv_obj_set_event_cb(lvgl_ZhuoMian_Button[i], lvgl_ZhuoMian_button_cb);//设置 btn3的事件回调
		}









		ZhuoMian_DEBUG("创建窗口\r\n");
	}
	else
	{

		ZhuoMian_DEBUG("显示窗口\r\n");
	}
	lv_obj_set_drag_throw(lvgl_ZhuoMian_main_cont, false);//启用/禁用拖动后是否有惯性移动


	lvgl_set_obj_show(lvgl_ZhuoMian_main_cont);


	ZhuoMian_DongHua_Jin();

	lvgl_ZhuoMian_task = lvgl_task_create(lvgl_ZhuoMian_TaskCb, 200, LV_TASK_PRIO_LOWEST, NULL);

}

void lvgl_ZhuoMian_close(void)
{

	//lv_obj_del_async(lvgl_LaoHuangLi_main_cont);
	lvgl_task_delete(lvgl_ZhuoMian_task);
	lvgl_set_obj_hide(lvgl_ZhuoMian_main_cont);

	lv_obj_set_x(lvgl_ZhuoMian_main_cont,0);

	lvgl_ZhuoMian_GongNeng_Data.point.y = lv_obj_get_y(lvgl_ZhuoMian_main_cont);
	lvgl_ZhuoMian_GongNeng_Data.point.x = lv_obj_get_x(lvgl_ZhuoMian_main_cont);


	lvgl_ZhuJieMian_create(lv_scr_act());

}

void lvgl_ZhuoMian_TaskCb(lv_task_t *t)
{

	if (lv_obj_get_y(lvgl_ZhuoMian_main_cont) != 0)
	{
		lv_obj_set_drag_throw(lvgl_ZhuoMian_main_cont, true);//启用/禁用拖动后是否有惯性移动

	}

	if (lv_obj_get_x(lvgl_ZhuoMian_main_cont) != 0)
	{
		lv_obj_set_drag_throw(lvgl_ZhuoMian_main_cont, false);//启用/禁用拖动后是否有惯性移动

	}

}








void ZhuoMian_anim_01(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_02(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_03(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_04(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_05(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_06(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_07(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_08(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_09(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_10(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_11(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_12(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_13(void * arc, lv_anim_value_t v)
{
	lv_obj_set_y(arc, v);
}
void ZhuoMian_anim_Jin_ready_cb(lv_anim_t * anim)
{
	//ZhuoMian_DEBUG("Jin ok\r\n");
}
void ZhuoMian_anim_Chu_ready_cb(lv_anim_t * anim)
{
	//ZhuoMian_DEBUG("chu ok\r\n");

	lv_event_send(lvgl_ZhuoMian_GongNeng_Data.AnXia_button, ZhuoMian_event_anXia,NULL);
	//ZhuoMian_DongHua_Jin();
}

void(*ZhuoMian_anim_cb_buf[ZhuoMian_Button_Num])(void * arc, lv_anim_value_t v) =
{
	&ZhuoMian_anim_01,
	&ZhuoMian_anim_02,
	&ZhuoMian_anim_03,
	&ZhuoMian_anim_04,
	&ZhuoMian_anim_05,
	&ZhuoMian_anim_06,
	&ZhuoMian_anim_07,
	&ZhuoMian_anim_08,
	&ZhuoMian_anim_09,
	&ZhuoMian_anim_10,
	&ZhuoMian_anim_11,
	&ZhuoMian_anim_12,
	&ZhuoMian_anim_13,



};

//滑入动画
void ZhuoMian_DongHua_Jin(void)
{
	int i = 0;
	int max = ZhuoMian_Button_Num;

	lv_anim_path_t path;
	lv_anim_path_init(&path);
	lv_anim_path_set_cb(&path, lv_anim_path_overshoot);
	//lv_anim_path_linear线性动画
	//lv_anim_path_step最后一步更改
	//lv_anim_path_ease_in开头很慢
	//lv_anim_path_ease_out最后慢
	//lv_anim_path_ease_in_out在开始和结束时也很慢
	//lv_anim_path_overshoot超出最终值
	//lv_anim_path_bounce从最终值反弹一点（就像撞墙一样）

	for (i = 0; i < max-1; i++)
	{
		lv_obj_set_y(lvgl_ZhuoMian_Button[i], 240);


		lv_anim_init(&ZhuoMian_ChuangKou.lv_anim_Jin[i]);
		if (i == max-1)
		{
			lv_anim_set_ready_cb(&ZhuoMian_ChuangKou.lv_anim_Jin[i], ZhuoMian_anim_Jin_ready_cb);
		}

		lv_anim_set_exec_cb(&ZhuoMian_ChuangKou.lv_anim_Jin[i], ZhuoMian_anim_cb_buf[i]);
		lv_anim_set_values(&ZhuoMian_ChuangKou.lv_anim_Jin[i], 240, ZhuoMian_BUTTON_area[i].y1);
		lv_anim_set_time(&ZhuoMian_ChuangKou.lv_anim_Jin[i], 200+i*10);
		lv_anim_set_var(&ZhuoMian_ChuangKou.lv_anim_Jin[i], lvgl_ZhuoMian_Button[i]);

		lv_anim_set_path(&ZhuoMian_ChuangKou.lv_anim_Jin[i], &path);
		lv_anim_start(&ZhuoMian_ChuangKou.lv_anim_Jin[i]);
	}

	
}
void ZhuoMian_anim_cb_DongHua(void * arc, lv_anim_value_t v)
{
	lv_obj_set_pos(arc, ZhuoMian_ChuangKou.lv_DongHua_area.x1-v/2, ZhuoMian_ChuangKou.lv_DongHua_area.y1-v/2);
	lv_obj_set_size(arc, ZhuoMian_ChuangKou.lv_DongHua_area.x2+v, ZhuoMian_ChuangKou.lv_DongHua_area.y2 + v);

}
void ZhuoMian_anim_ready_DongHua_cb(lv_anim_t * anim)
{
	lv_event_send(lvgl_ZhuoMian_GongNeng_Data.AnXia_button, ZhuoMian_event_anXia, NULL);

	lv_obj_del(ZhuoMian_ChuangKou.lvgl_btn_DongHua);
	lv_style_reset(&ZhuoMian_ChuangKou.lvgl_btn_DongHua_style);

}
//滑出动画
void ZhuoMian_DongHua_Chu(void)
{
	int x = 0, y = 0;

	lv_style_init(&ZhuoMian_ChuangKou.lvgl_btn_DongHua_style);
	lv_style_copy(&ZhuoMian_ChuangKou.lvgl_btn_DongHua_style, &lvgl_ZhuoMian_Button_style[lvgl_ZhuoMian_GongNeng_Data.AnXia_Num]);
	lv_style_set_radius(&ZhuoMian_ChuangKou.lvgl_btn_DongHua_style, LV_STATE_DEFAULT, 30);//圆角


	ZhuoMian_ChuangKou.lvgl_btn_DongHua = lv_btn_create(lv_scr_act(), lvgl_ZhuoMian_GongNeng_Data.AnXia_button);

	ZhuoMian_ChuangKou.lv_DongHua_area.x1 = lv_obj_get_x(lvgl_ZhuoMian_GongNeng_Data.AnXia_button);
	ZhuoMian_ChuangKou.lv_DongHua_area.y1 = lv_obj_get_y(lvgl_ZhuoMian_GongNeng_Data.AnXia_button);
	ZhuoMian_ChuangKou.lv_DongHua_area.x2 = lv_obj_get_width(lvgl_ZhuoMian_GongNeng_Data.AnXia_button);
	ZhuoMian_ChuangKou.lv_DongHua_area.y2 = lv_obj_get_height(lvgl_ZhuoMian_GongNeng_Data.AnXia_button);
	y= lv_obj_get_y(lvgl_ZhuoMian_main_cont);
	ZhuoMian_ChuangKou.lv_DongHua_area.y1 += lv_obj_get_y(lvgl_ZhuoMian_main_cont);

	lv_obj_set_y(ZhuoMian_ChuangKou.lvgl_btn_DongHua, ZhuoMian_ChuangKou.lv_DongHua_area.y1);

	lvgl_ZhuoMian_GongNeng_Data.DongHua_KaiShiZhi = fmin(ZhuoMian_ChuangKou.lv_DongHua_area.x2, ZhuoMian_ChuangKou.lv_DongHua_area.y2);

	lv_anim_init(&ZhuoMian_ChuangKou.lv_DongHua_anim);
	lv_anim_set_ready_cb(&ZhuoMian_ChuangKou.lv_DongHua_anim, ZhuoMian_anim_ready_DongHua_cb);
	lv_anim_set_exec_cb(&ZhuoMian_ChuangKou.lv_DongHua_anim, ZhuoMian_anim_cb_DongHua);
	lv_anim_set_values(
		&ZhuoMian_ChuangKou.lv_DongHua_anim, 
		lvgl_ZhuoMian_GongNeng_Data.DongHua_KaiShiZhi,
		400
	);
	lv_anim_set_time(&ZhuoMian_ChuangKou.lv_DongHua_anim, 200);
	lv_anim_set_var(&ZhuoMian_ChuangKou.lv_DongHua_anim, ZhuoMian_ChuangKou.lvgl_btn_DongHua);
	lv_anim_start(&ZhuoMian_ChuangKou.lv_DongHua_anim);


/*	int i = 0;
	int max = ZhuoMian_Button_Num;
	for (i = 0; i < max-1; i++)
	{
		lv_obj_set_y(lvgl_ZhuoMian_Button[i], ZhuoMian_BUTTON_area[i].y1);

		lv_anim_init(&ZhuoMian_ChuangKou.lv_anim_Chu[i]);
		if (i == max-1)
		{
			lv_anim_set_ready_cb(&ZhuoMian_ChuangKou.lv_anim_Chu[i], ZhuoMian_anim_Chu_ready_cb);
		}
		lv_anim_set_exec_cb(&ZhuoMian_ChuangKou.lv_anim_Chu[i], ZhuoMian_anim_cb_buf[i]);
		
		lv_anim_set_values(&ZhuoMian_ChuangKou.lv_anim_Chu[i], ZhuoMian_BUTTON_area[i].y1, 240);
		lv_anim_set_time(&ZhuoMian_ChuangKou.lv_anim_Chu[i], 200 + i * 10);
		lv_anim_set_var(&ZhuoMian_ChuangKou.lv_anim_Chu[i], lvgl_ZhuoMian_Button[i]);
		lv_anim_start(&ZhuoMian_ChuangKou.lv_anim_Chu[i]);
	}

*/

}

